package com.csweimei.rentmanagementtreasure.tenant.ui.act.house;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProviders;

import android.os.Bundle;

import com.chad.library.BR;
import com.csweimei.rentmanagementtreasure.R;
import com.csweimei.rentmanagementtreasure.base.AppViewModelFactory;
import com.csweimei.rentmanagementtreasure.databinding.ActivityNoticeMessBinding;
import com.csweimei.rentmanagementtreasure.tenant.viewModel.NoticeMessVM;

import me.goldze.mvvmhabit.base.BaseActivity;

public class NoticeMessActivity extends BaseActivity<ActivityNoticeMessBinding, NoticeMessVM> {

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_notice_mess;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    String flag;
    String msg;
    @Override
    public void initParam() {
        super.initParam();
        flag = getIntent().getStringExtra("flag");
        msg = getIntent().getStringExtra("msg");
    }

    @Override
    public void initData() {
        super.initData();
        viewModel.setActivity(this);
        viewModel.msg.set(msg);
        if (flag.equals("cz")){
            viewModel.setTitleText("催租");
            viewModel.getMsg("收租");
        }else {
            viewModel.setTitleText("提醒房东");
            viewModel.getMsg("提醒");
        }

    }

    @Override
    public NoticeMessVM initViewModel() {
        AppViewModelFactory factory  =  AppViewModelFactory.getInstance(getApplication());
        return ViewModelProviders.of(this,factory).get(NoticeMessVM.class);
    }
}